<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <base href="/">
<meta http-equiv="pragma" content="no-cache"/>
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
</head>
<style>
table th{
    color:white ;
    background-color: rgb(93, 213, 200) ;
    width: 170px ;
    height: 50px ;
    font-size: 20px;
}
table td a{
    text-decoration: none ;
}
table th,table td{
    text-align: center ;
}

</style>
<body>
{% extends "motherboard.html"%}
{% block shop %}
<div class="panel panel-default">
        <div id="collapseTwo" class="panel-collapse collapse">
			<div class="panel-body">
                {% load static %}
				<img width="1200px" height="500px" src="{{message1}}" alt="" >
			</div>
		</div>
		<div class="panel-heading">
<table border="1" class="table table-striped" class="table table-condensed">
    <tr>
    <th>上周排名</th>
    <th>款式编码</th>
    <th>分类</th>
    <th>上周销量</th>
    <th>上上周销量</th>
    <th>库存</th>
    <th>库存预警</th>
    <th>操作</th>
    </tr>
    {% for line in page_obj.object_list %}
    <tr>
        <td>{{line.rank}}</td>
        <td>{{line.number}}</td>
        <td>{{line.cation}}</td>
        <td>{{line.sales_1}}</td>
        <td>{{line.sales_2}}</td>
        <td>{{line.stock}}</td>
        <td>{{line.warn}}</td>
        <td>
            <a href="/index1/img/?number={{ line.number }}&page={{num_p}}&choice={{choice}}&fenlei={{fenlei}}">生成图</a>
            <a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">查看</a>
        </td>
    </tr>
    {% endfor %}
</table>
	</div>
</div>
<ul class="pagination">
	<li><a href='/index1/sales/?page=1&choice={{choice}}&fenlei={{fenlei}}'>首页</a></li>
	{% if page_obj.has_previous %}
            <li><a href="/index1/sales/?page={{ page_obj.previous_page_number }}&choice={{choice}}&fenlei={{fenlei}}" >上一页</a></li>
            {# 如果上一页没有数据了，那么不让做任何操作 #}
        {% else %}
        {% endif %}

    {% if data.first %}
                    <li><a href="/index1/sales/?page=1&choice={{choice}}&fenlei={{fenlei}}">1</a></li>
                {% endif %}
                {% if data.left %}
                    {% if data.left_s %}
                        <li><a href="#">...</a></li>
                    {% endif %}
                    {% for i in data.left %}
                        <li><a href="/index1/sales/?page={{ i }}&choice={{choice}}&fenlei={{fenlei}}">{{ i }}</a></li>
                    {% endfor %}
                {% endif %}
                <li><a href="#"> {{ page_num }}</a></li>
                {% if data.right %}
                    {% for i in data.right %}
                        <li><a href="/index1/sales/?page={{ i }}&choice={{choice}}&fenlei={{fenlei}}">{{ i }}</a></li>
                    {% endfor %}
                    {% if data.right_s %}
                        <li><a href="#">...</a></li>
                    {% endif %}
                {% endif %}
                {% if data.last %}
                    <li ><a href="/index1/sales/?page={{ paginator.num_pages }}&choice={{choice}}&fenlei={{fenlei}}">{{ paginator.num_pages }}</a>
                    </li>
                {% endif %}

	{# 如果当前页还有下一页，那么让其可以点击进入下一页 #}
        {% if page_obj.has_next %}
            <li><a href="/index1/sales/?page={{ page_obj.next_page_number }}&choice={{choice}}&fenlei={{fenlei}}" >下一页</a></li>
        {% endif %}
	{# 跳转到尾页，让page参数直接等于总页数 #}
        <li><a href='/index1/sales/?page={{ paginator.num_pages }}&choice={{choice}}&fenlei={{fenlei}}'>尾页</a></li>
</ul>
{% endblock %}
</body>
<script>
  $(".panel-body").each(function(index,domEle){
        var obj = $(this).find("a").find("img");
        obj.attr("src",obj.attr("src")+Math.random());
    });
</script>
</html>